{include file="pub:header"/}
<script type="text/javascript">
$(function(){
	$('.J_tablelist').listTable();
});

function setStatus(id, status) {
	if(!id || id.length == 0)return alert("请选择一条记录");

	$('#myform').attr('action', "{:url('state')}");
	$('#state').val(status);
	ajaxpost('myform');
}
function editInfo(id){
  art.dialog.open('{:url(\'edit\')}?id='+id,{title:'编辑账号信息',id:'cats',width:700,height:450,lock: true,fixed:true,close:function(){location.reload(true);}});
}
function editCash(id){
	art.dialog.open('{:url(\'cashedit\')}?uid='+id,{title:'编辑资金信息',id:'cats',width:700,height:450,lock: true,fixed:true,close:function(){location.reload(true);}});
}
</script>
</head>
<body>


	<div class="subnav">
		<div class="content_menu ib_a blue line_x">
            <a href="javascript:;"><span class="pagetitle">【会员管理】</span></a>
            <span>|</span>
			<a class="add fb J_showdialog" href="javascript:;" onclick="editInfo(0);"><em>添加账号</em></a>
		</div>
	</div>

	<div class="pad_lr_10">

		<form action="{:url('index')}" method="get">

			<table width="100%" cellspacing="0" class="search_form">
			<input type="hidden" name="state" value="{$state}">
				<tbody>
					<tr>
						<td>
							<div class="explain_col">
								ID <input name="id" type="text" class="input-text" size="10" value="{$id}">
								账号/邮箱 <input name="keyword" type="text" class="input-text" size="20" value="{$keyword}">
								姓名/昵称 <input name="name" type="text" class="input-text" size="20" value="{$name}">
								<select name="sex">
									<option value="-1">=性别=</option>
									{volist name=":get_sex_rtn()" id="vo"}
									<option value="{$key}"<?php echo $sex==$key?' selected':'';?>>{$vo}</option>
									{/volist}
								</select>
								<select name="time">
									<option value="time_reg"<?php echo 'time_reg'==$time?' selected':'';?>>注册时间</option>
									<option value="time_login"<?php echo 'time_login'==$time?' selected':'';?>>登录时间</option>
								</select>
								<input name="starttime" type="text" size="13" id="d4311" onfocus="WdatePicker({maxDate:'#F{ $dp.$D(\'d4312\')}'})" class="input-text Wdate" value="{$starttime}" readonly>
								至
								<input name="endtime" type="text" size="13" id="d4312" onfocus="WdatePicker({minDate:'#F{ $dp.$D(\'d4311\')}'})" class="input-text Wdate" value="{$endtime}" readonly>
								<select name='sort_type' class='select'>
									{volist name="sort_ary" id="vo"}
										<option value='{$key}'<?php echo $sort_type==$key?' selected':'';?>>
										{$vo}
										</option>
									{/volist}
								</select>
								<select name='sort_key' class='select'>
									{volist name="sort_atr" id="vo"}
										<option value='{$key}'<?php echo $sort_key==$key?' selected':'';?>>
										{$vo}
										</option>
									{/volist}
								</select>
								<input type="submit" class="btn" value="搜索" />
							</div>
						</td>
					</tr>
				</tbody>
			</table>

		</form>


      <div class="col_tab" style="margin-top:5px;">
		<ul class="J_tabs tab_grid cu_li">
		   {volist name="reviewary" id="vo"}
		   <li<?php echo $key==$state?' class="current"':'' ?>><a href="{:url('index')}?state={$key}">{$vo}</a></li>
		   {/volist}
		</ul>

		<div class="J_tablelist table_list">

			<table width="100%" cellspacing="0">

				<thead>
					<tr>
					    <th width="40"><input type="checkbox" name="checkall" class="J_checkall"></th>
						<th align="left" width="60">ID</th>
						<th align="left">账号信息</th>
						<th align="left">姓名昵称性别</th>
						<th align="left">时间</th>
						<th align="left">账号余额</th>
						<th>登录次数</th>
						<th>状态</th>
						<th>操作</th>
					</tr>
				</thead>

				<form action="" id="myform">
				<input type="hidden" name="state" value="1" id="state">
					<tbody>
						{volist name="list" id="vo"}
						<tr>
						    <td align="center"><input type="checkbox" name='id[]' class="J_checkitem" value="{$vo['id']}"></td>
							<td>{$vo['id']}</td>
							<td>
								账号：{$vo['account']}<br/>
								邮箱：{$vo['email']}
							</td>
							<td>
								姓名：{$vo['name']}<br/>
								昵称：{$vo['nick']}<br/>
								性别：{$vo['sex']|get_sex_rtn}
							</td>
							<td align="left">
								登录时间：<?php echo $vo['time_login']?date('Y-m-d H:i:s',$vo['time_login']):'未登录';?><br/>
								注册时间：{$vo['time_reg']|date="Y-m-d H:i:s"}
							</td>
							<td>￥{$vo['cash']}</td>
							<td align="center">{$vo['count_login']}</td>
							<td align="center"><?php echo 1==$vo['state']?"<font color='green'>启用</font>":"<font color='red'>禁用</font>";?></td>
							<td align="center">
								【<a href="javascript:;" onclick="editInfo({$vo['id']})" title="点击修改">修改</a>】
								<?php if(1==$vo['state']){ ?>
							            【<a href="javascript:;" onclick="ajaxurl('{:url('state',array('id'=>$vo['id'],'state'=>2))}');" title="点击禁用">禁用</a>】
								<?php }else{ ?>
								【<a href="javascript:;" onclick="ajaxurl('{:url('state',array('id'=>$vo['id'],'state'=>1))}');" title="点击启用"><font color="red">启用</font></a>】
								<?php } ?>
								【<a href="javascript:;" onclick="editCash({$vo['id']});">余额</a>】
							</td>
						</tr>
						{/volist}

						{empty name="list"}
						<tr>
							<td colspan="8" align="center">暂无数据 !</td>
						</tr>
						{/empty}
					</tbody>
				</form>

			</table>

		</div>

		</div>


		<div class="btn_wrap_fixed">
		    <label class="select_all mr10"><input type="checkbox" name="checkall" class="J_checkall">全选/取消</label>
            <input type="button" value="批量启用" class="btn" onclick="setStatus($.checkBoxValue('id[]'),1)"/>
            <input type="button" value="批量禁用" class="btn" onclick="setStatus($.checkBoxValue('id[]'),2)"/>
			<div id="pages">{$res|raw}</div>
		</div>

    </div>

{include file="pub:footer" /}
